package com.pda.common.tools;

import android.content.Context;
import android.content.SharedPreferences;

//SharedPreferences管理
public  class SharedPreferencesManger {
    public static SharedPreferences sSharedPreferences;
    public static SharedPreferences.Editor sEditor;
    public static String version="version";
    public static String versionname="versionname";
    public static String hostname="hostname";
    public static String cid="cid";
    public static String uname="uname";
    public static String upass="upass";
    public static String urem="urem";
    public static String uid="uid";
    public static String storename="storename";
    public static String storeid="storeid";
    public static String storecode="storecode";
    public static String casemix="casemix";
    public static String casemax="casemax";
    public static String boxmix="boxmix";
    public static String boxmax="boxmax";

    public static void init(Context context) {
        sSharedPreferences = context.getSharedPreferences("SHARE_KEY", context.MODE_PRIVATE);
        sEditor = sSharedPreferences.edit();;
    }

    public static int getVersion() {
        return sSharedPreferences.getInt(version,0);
    }
    public static void setVersion(int v) {
        sEditor.putInt(version, v);
        sEditor.commit();
    }

    public static String getVersionName() {
        return sSharedPreferences.getString(versionname,"");
    }
    public static void setVersionName(String str) {
        sEditor.putString(version, str);
        sEditor.commit();
    }

    public static String getHostName() {
        return sSharedPreferences.getString(hostname,"saas.zaosin.cn");
    }
    public static void setHostName(String str) {
        sEditor.putString(hostname, str);
        sEditor.commit();
    }

    public static String getCid() {
        return sSharedPreferences.getString(cid,"");
    }
    public static void setCid(String str) {
        sEditor.putString(cid, str);
        sEditor.commit();
    }

    public static String getUname() {
        return sSharedPreferences.getString(uname,"");
    }
    public static void setUname(String str) {
        sEditor.putString(uname, str);
        sEditor.commit();
    }

    public static boolean getRem() {
        return sSharedPreferences.getBoolean(urem,false);
    }
    public static void setRem(boolean flag) {
        sEditor.putBoolean(urem, flag);
        sEditor.commit();
    }

    public static String getUpass() {
        return sSharedPreferences.getString(upass,"");
    }
    public static void setUpass(String str) {
        sEditor.putString(upass, str);
        sEditor.commit();
    }

    public static String getUID() {
       return sSharedPreferences.getString(uid,"");
    }
    public static void setUID(String str) {
        sEditor.putString(uid, str);
        sEditor.commit();
    }

    public static String getStoreName() {
        return sSharedPreferences.getString(storename,"");
    }
    public static void setStoreName(String str) {
        sEditor.putString(storename, str);
        sEditor.commit();
    }

    public static String getStoreID() {
        return sSharedPreferences.getString(storeid,"");
    }
    public static void setStoreID(String str) {
        sEditor.putString(storeid, str);
        sEditor.commit();
    }

    public static String getStoreCode() {
        return sSharedPreferences.getString(storecode,"");
    }
    public static void setStoreCode(String str) {
        sEditor.putString(storecode, str);
        sEditor.commit();
    }

    public static int getCaseMix() {
        return sSharedPreferences.getInt(casemix,0);
    }
    public static void setCaseMix(int value) {
        sEditor.putInt(casemix, value);
        sEditor.commit();
    }

    public static int getCaseMax() {
        return sSharedPreferences.getInt(casemax,0);
    }
    public static void setCaseMax(int value) {
        sEditor.putInt(casemax, value);
        sEditor.commit();
    }

    public static int getBoxMix() {
        return sSharedPreferences.getInt(boxmix,0);
    }
    public static void setBoxMix(int value) {
        sEditor.putInt(boxmix, value);
        sEditor.commit();
    }

    public static int getBoxMax() {
        return sSharedPreferences.getInt(boxmax,0);
    }
    public static void setBoxMax(int value) {
        sEditor.putInt(boxmax, value);
        sEditor.commit();
    }
}
